<?php include("includes/session.php"); ?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?php echo $lang['PAGE_TITLE_EDIT_PROJECT_MEMBERS']; ?></title>
<?php include("header.php"); ?>
	<br />
	<center>
	<table width="97%">
	<tr>
		<td valign="top" width="14%">
			<table cellpadding="0" cellspacing="0">
			<tr>
				<td class="topLeft"></td><td bgcolor="#dadada"></td><td class="topRight"></td>
			</tr>
			<tr bgcolor="#dadada">
				<td></td><td>
				<center><a href="viewProject.php?id=<?php echo htmlspecialchars($_GET['id']); ?>"><?php echo $lang['EDIT_PROJECT_BACKTOPROJECT']; ?></a></center>
				</td><td></td>
			</tr>
			<tr>
				<td class="bottomLeft"></td><td bgcolor="#dadada"></td><td class="bottomRight"></td>
			</tr>
			</table>
		</td>
		<td valign="top">
			<?php
			$project = $database->getProject($_GET['id']);
			$resul = $database->query("SELECT * FROM ".TBL_PROJECT_MEMBERS." WHERE projectID='".$project['id']."' AND username='".$session->username."'");
			$projectMember = mysql_fetch_array($resul);
				
			if(!$session->logged_in)
			{
				echo "<table cellpadding=\"0\" cellspacing=\"0\">";
				echo "<tr>";
				echo "<td class=\"topLeft\"></td><td bgcolor=\"#dadada\"></td><td class=\"topRight\"></td>";
				echo "</tr>";
				echo "<tr bgcolor=\"#dadada\">";
				echo "<td></td><td>";
				
				echo "<center><h2>Restricted Area</h2></center>";
				echo "<center>Please <a href=\"index.php\">Log In</a>.</center>";
				
				echo "</td><td></td>";
				echo "</tr>";
				echo "<tr>";
				echo "<td class=\"bottomLeft\"></td><td bgcolor=\"#dadada\"></td><td class=\"bottomRight\"></td>";
				echo "</tr>";
				echo "</table>";
			}
			else if($project['creator']==$session->username || $session->userlevel>=MANAGER_LEVEL || $projectMember['userlevel']>=PROJECT_OWNER)
			{
			?>
			<center>
			<table cellpadding="0" cellspacing="0">
			<tr>
				<td class="topLeft"></td><td bgcolor="#dadada"></td><td class="topRight"></td>
			</tr>
			<tr bgcolor="#dadada">
				<td></td><td>
				<center><font size="+1"><b><?php echo $lang['EDIT_PROJECTMEMBERS_MEMBERS']; ?></b></font></center>
				<?php
				if(isset($_SESSION['editProjectMember']))
				{
					if($_SESSION['editProjectMember'])
					{
						echo "<center><font color=\"#196c00\">Edit Member Successful</font></center>";
					}
					else
					{
						echo "<center><font color=\"#6c0000\">Edit Member Failed</font></center>";
					}
					unset($_SESSION['editProjectMember']);
				}
				else if(isset($_SESSION['deleteProjectMember']))
				{
					if($_SESSION['deleteProjectMember'])
					{
						echo "<center><font color=\"#196c00\">Delete Member Successful</font></center>";
					}
					else
					{
						echo "<center><font color=\"#6c0000\">Delete Member Failed</font></center>";
					}
					unset($_SESSION['deleteProjectMember']);
				}
				?>
				<br />
				<?php displayAdminMembers($_GET['id'],30); ?>
				</td><td></td>
			</tr>
			<tr>
				<td class="bottomLeft"></td><td bgcolor="#dadada"></td><td class="bottomRight"></td>
			</tr>
			</table>
			</center>
			<?php
			}
			?>
		</td>
		<td valign="top" width="14%">
	</tr>
	</table>
	</center>
<?php include("footer.php"); ?>